<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/10/14
  Time: 15:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%@include file="common/header.jsp"%>
    <link rel="stylesheet" href="assets/css/auth.css">
    <script>
        var layer;
        $(function () {
            layui.use('layer',function () {
                layer=layui.layer;
            });
        });
        function sub() {
            // alert($("#form1").serialize());
            //用js脚本去提交表单
            // $("form:first").submit();
            // 发送异步请求
            $.ajax({
                type: "post", //请求的方式：post
                url: "alogin.action",//请求的路径
                // data: "name=John&location=Boston",
                // data:{userName:$("#userName").val(),pwd:$("#pwd").val()}, //要提交的参数
                data:$("#form1").serialize(),//表单序列化
                // 成功后要执行的回调函数
                success: function(msg){
                    if(msg=="ok"){
                        location.href="admin/index.html?user=user_id";

                    }else{
                        layer.msg("用户名或者密码错误");
                    }
                },
                error:function (xhr,info,e) {
                    alert("错误："+info+e);
                }
            });
        }
    </script>
</head>
<body>
<div class="lowin lowin-blue">
    <div class="lowin-brand">
        <img src="assets/images/kodinger.jpg" alt="logo">
    </div>
    <div class="lowin-wrapper">
        <div class="lowin-box lowin-login">
            <div class="lowin-box-inner">
                <form id="form1">
                    <p style="font-size: 20px">培训班管理系统</p>
                    <div class="lowin-group">
                        <label >用户名 <a href="#" class="login-back-link">登录?</a></label>
                        <input  type="text"  name="username" class="lowin-input">
                    </div>
                    <div class="lowin-group password-group">
                        <label > 密码</label>
                        <input  type="password" name="pwd" autocomplete="current-password" class="lowin-input">
                    </div>

                    <%--<div class="text-foot">--%>
                        <%--没有账户? <a href="" class="register-link">注册</a>--%>
                    <%--</div>--%>
                </form>
                <button class="lowin-btn login-btn" onclick="sub()"  >
                    登录
                </button>
            </div>
        </div>

        <div class="lowin-box lowin-register">
            <div class="lowin-box-inner">
                <form>
                    <p>注册</p>
                    <div class="lowin-group">
                        <label>用户名</label>
                        <input type="text" name="name"  class="lowin-input">
                    </div>
                    <div class="lowin-group">
                        <label>邮箱</label>
                        <input type="email" autocomplete="email" name="email" class="lowin-input">
                    </div>
                    <div class="lowin-group">
                        <label>密码</label>
                        <input type="password" name="password" autocomplete="current-password" class="lowin-input">
                    </div>
                    <button class="lowin-btn">
                        注册
                    </button>

                    <div class="text-foot">
                        已经拥有账户? <a href="" class="login-link" >登录</a>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <footer class="lowin-footer">
        <!--<a href="index.jsp">测试页面</a>-->
    </footer>
</div>

<script src="assets/js/auth.js"></script>
<script>
    Auth.init({
        login_url: '',
        forgot_url: '#forgot'
    });
</script>
</body>
</html>
